public class demo5 {
    public static void main(String[] args) throws ArrayIndexOutOfBoundsException{
        int[] arr = new int[]{1,2,3,4,5}; //声明与初始化，长度是5
        arr[8] = 0;  //，索引值越界，索引值是 0~4

        for(int i = 0;i <= arr.length;i++){   //从0到5遍历，索引值越界
            System.out.println(arr[i]);
        }
    }
}
